package com.leesche.zcsp.node.web.vo.v2.enums;

/**
 * Created by kaider on 2016/12/15.
 */
public enum DeviceEnum {
    ONLINE(1,"onLine"),
    OFFLINE(2,"offLine"),
    DISABLED(3,"disabled"),
    FAULT(4,"fault");

    private Integer code;
    private String message;

    DeviceEnum(int code, String message)
    {
        this.code = code;
        this.message = message;
    }


    public Integer getCode()
    {
        return code;
    }

    public String getMessage()
    {
        return message;
    }

    static public DeviceEnum parse(Integer code)
    {
        for (DeviceEnum each : DeviceEnum.values())
        {
            if (each.getCode().equals(code))
            {
                return each;
            }
        }
        return null;
    }

    static public DeviceEnum parse(String message)
    {
        for(DeviceEnum each : DeviceEnum.values())
        {
            if (each.getMessage().equals(message))
            {
                return each;
            }
        }
        return null;
    }

}
